import request from '@/utils/requestEbao';

// 参数配置
// 查询
export function parameterQuery(userId) {
  return request({
    url: `/parameter/query/${userId}`,
    method: 'get',
  })
}
// 保存
export function parameterSave(data) {
  return request({
    url: '/parameter/addUpdate',
    method: 'post',
    data: data
  })
}

// 删除
export function parameterDelete(listId) {
  return request({
    url: `/parameter/delete/${listId}`,
    method: 'delete',
  })
};


// 相关性定义-查询
export function defineQuery(data) {
  return request({
    url: '/safeguard/parameter/correldefine/query',
    method: 'post',
    data: data
  })
}

// 相关性定义-保存
export function defineSave(data) {
  return request({
    url: '/safeguard/parameter/correldefine/save',
    method: 'post',
    data: data
  })
}

// 保障责任配置
// 查询
export function categoryQuery(userId) {
  return request({
    url: `/category/query/${userId}`,
    method: 'get',
  })
};

// 保存
export function categorySave(data) {
  return request({
    url: '/category/addUpdate',
    method: 'post',
    data: data
  })
}

// 删除
export function categoryDelete(listId) {
  return request({
    url: `/category/delete/${listId}`,
    method: 'delete',
  })
};

// 公式/规则配置
// 查询
export function ruleQuery(userId) {
  return request({
    url: `/formula/query/${userId}`,
    method: 'get',
  })
};

// 删除
export function ruleDelete(formulaId) {
  return request({
    url: `/formula/delete/${formulaId}`,
    method: 'delete',
  })
};

// 保存
export function ruleSave(data) {
  return request({
    url: '/formula/addUpdate',
    method: 'post',
    data: data
  })
}
// 码值配置
// 查询
export function codeQuery(tableName) {
  return request({
    url: `/table/value/query/${tableName}`,
    method: 'get',
  })
};

// 保存
export function codeSave(data) {
  return request({
    url: `/table/value/addUpdate`,
    method: 'post',
    data: data
  })
}

// 删除
export function codeDelete(tableName,code) {
  return request({
    url: `/table/value/delete/${tableName}/${code}`,
    method: 'delete',
  })
};

// 码表配置
// 查询
export function tableQuery(tableName) {
  return request({
    url: `/table/query/${tableName}`,
    method: 'get',
  })
};

// 保存
export function tableSave(data) {
  return request({
    url: `/table/addUpdate`,
    method: 'post',
    data: data
  })
}

// 删除
export function tableDelete(listId) {
  return request({
    url: `/table/delete/${listId}`,
    method: 'delete',
  })
};


// 保障责任和公式的关系
// 查询
export function formulaFilterQuery(tableName) {
  return request({
    url: `/formulaFilter/query/${tableName}`,
    method: 'get',
  })
};

// 保存
export function formulaFilterSave(data) {
  return request({
    url: `/formulaFilter/addUpdate`,
    method: 'post',
    data: data
  })
}
// 
export function formulaData(formulaId) {
  return request({
    url: `/formula/nodes/${formulaId}`,
    method: 'get',
  })
}

// 产品推荐
export function productRecommend(data) {
  return request({
    url: '/recommend',
    method: 'post',
    data: data
  })
};
